package com.snpic.appaw.module.third.controller.app.bjpt;

import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.snpic.appaw.framework.common.pojo.CommonResult;
import com.snpic.appaw.module.third.api.bjpt.dto.CarModelInfoInquiryReqDto;
import com.snpic.appaw.module.third.api.bjpt.dto.CarModelInfoInquiryReqTotalDto;
import com.snpic.appaw.module.third.api.bjpt.dto.CarModelInfoInquiryRespTotalDto;
import com.snpic.appaw.module.third.api.bjpt.dto.CxRequestHeadDto;
import com.snpic.appaw.module.third.enums.ThirdConstant;
import com.snpic.appaw.module.third.service.bjpt.BJPTInvocationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import static com.snpic.appaw.framework.common.exception.util.ServiceExceptionUtil.exception;

/**
 * @author JiJun
 * @date 2025/9/20 17:39
 * @修改时间 2025/9/20 17:39
 * @description 报价平台相关接口Controller
 */
@Tag(name = "C端 - 第三方接口Controller - 报价平台")
@RestController
@RequestMapping("/third/btpt")
@Validated
public class BJPTInvocationController {
	@Resource
	private BJPTInvocationService bjptInvocationService;


	/**
	 * 车辆车型查询接口
	 */
	@PostMapping("/carModelInfoInquiry")
	@Operation(summary = "车辆车型查询接口")
	public CommonResult<CarModelInfoInquiryRespTotalDto> carModelInfoInquiry(
		@RequestBody @Valid CarModelInfoInquiryReqTotalDto reqDTO
	) {

		//为了方便前端调用，赋予固定值
		CxRequestHeadDto cxRequestHeadDto = reqDTO.getRequestHead();
		//北京地区的虚拟业务员
		cxRequestHeadDto.setComCode("018030");
		cxRequestHeadDto.setUserCode("018030A10034");
		cxRequestHeadDto.setClientSeqNo(UUID.randomUUID().toString());
		CarModelInfoInquiryReqDto requestBody = reqDTO.getRequestBody();
		requestBody.setCompanyCode(cxRequestHeadDto.getComCode());
		return bjptInvocationService.carModelInfoInquiry(reqDTO);
	}
}
